
package org.come.Frame;

import com.tool.tcpimg.UIUtils;
import org.come.Jpanel.PXSupportListJpanel;
import org.come.Jpanel.SupportListJpanel;
import org.come.until.FormsManagement;
import org.come.until.Music;

import javax.swing.*;
import javax.swing.plaf.basic.BasicInternalFrameUI;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;

public class PXSupportListJframe extends JInternalFrame implements MouseListener {
	private PXSupportListJpanel pXsupportListJpanel = new PXSupportListJpanel();
	private int first_x;
	private int first_y;

	public static PXSupportListJframe getPXSupportListJframe() {
		return (PXSupportListJframe)FormsManagement.getInternalForm(620).getFrame();
	}

	public PXSupportListJframe() {
		this.getContentPane().add(this.pXsupportListJpanel);
		this.setBorder(BorderFactory.createEmptyBorder());
		((BasicInternalFrameUI)this.getUI()).setNorthPane((JComponent)null);
		this.setBounds(100, 50, 230, 320);
		this.setBackground(UIUtils.Color_BACK);
		this.pack();
		this.setVisible(false);
		this.setDefaultCloseOperation(3);
		this.addMouseListener(this);
		this.addMouseMotionListener(new MouseMotionListener() {
			@Override
            public void mouseMoved(MouseEvent e) {
			}

			@Override
            public void mouseDragged(MouseEvent e) {
				if (PXSupportListJframe.this.isVisible()) {
					int x = e.getX() - PXSupportListJframe.this.first_x;
					int y = e.getY() - PXSupportListJframe.this.first_y;
					PXSupportListJframe.this.setBounds(x + PXSupportListJframe.this.getX(), y + PXSupportListJframe.this.getY(), PXSupportListJframe.this.getWidth(), PXSupportListJframe.this.getHeight());
				}

			}
		});
	}

	@Override
    public void mouseClicked(MouseEvent e) {
	}

	@Override
    public void mousePressed(MouseEvent e) {
		Music.addyinxiao("关闭窗口.mp3");
		if (e.isMetaDown()) {
			FormsManagement.HideForm(620);
		} else {
			FormsManagement.Switchinglevel(620);
		}

		this.first_x = e.getX();
		this.first_y = e.getY();
	}

	@Override
    public void mouseReleased(MouseEvent e) {
	}

	@Override
    public void mouseEntered(MouseEvent e) {
	}

	@Override
    public void mouseExited(MouseEvent e) {
	}

	public PXSupportListJpanel getPXSupportListJpanel() {
		return this.pXsupportListJpanel;
	}

	public void setPXSupportListJpanel(PXSupportListJpanel pXsupportListJpanel) {
		this.pXsupportListJpanel = pXsupportListJpanel;
	}
}
